<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单详情 - 钓鱼小程序</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* 移动端滚动条优化 - 隐藏滚动条 */
        ::-webkit-scrollbar {
            display: none;
        }
        
        * {
            -ms-overflow-style: none;
            scrollbar-width: none;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background-color: #f5f5f5;
            color: #333;
            line-height: 1.6;
            max-width: 375px;
            margin: 0 auto;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            padding-top: 50px;
        }

        .header {
            position: fixed;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: 375px;
            background: #3498DB;
            color: white;
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            z-index: 100;
            justify-content: space-between;
        }

        .back-btn {
            background: none;
            border: none;
            color: white;
            font-size: 18px;
            cursor: pointer;
        }

        .header h1 {
            font-size: 18px;
            font-weight: 600;
            flex: 1;
            text-align: center;
        }

        /* 小程序胶囊按钮 */
        .capsule-btn {
            background: rgba(255,255,255,0.2);
            border-radius: 16px;
            padding: 6px 12px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .capsule-btn .dot {
            width: 4px;
            height: 4px;
            background: white;
            border-radius: 50%;
        }

        .main-content {
            flex: 1;
            padding-bottom: 80px;
        }

        .section {
            background: white;
            margin-bottom: 8px;
            padding: 16px;
        }

        .section-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 12px;
            color: #333;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* 订单状态 */
        .order-status-section {
            background: linear-gradient(135deg, #3498DB, #2ECC71);
            color: white;
            text-align: center;
            padding: 24px 16px;
        }

        .status-icon {
            width: 60px;
            height: 60px;
            background: rgba(255,255,255,0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 12px;
            font-size: 24px;
        }

        .status-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .status-desc {
            font-size: 14px;
            opacity: 0.9;
        }

        /* 物流信息 */
        .logistics-section {
            display: none;
        }

        .logistics-section.show {
            display: block;
        }

        .logistics-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 16px;
        }

        .logistics-icon {
            width: 40px;
            height: 40px;
            background: #3498DB;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 16px;
        }

        .logistics-info {
            flex: 1;
        }

        .logistics-status {
            font-size: 16px;
            font-weight: 600;
            color: #333;
            margin-bottom: 4px;
        }

        .logistics-time {
            font-size: 12px;
            color: #666;
        }

        .tracking-number {
            background: #f8f9fa;
            padding: 12px;
            border-radius: 8px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .tracking-label {
            font-size: 14px;
            color: #666;
        }

        .tracking-value {
            font-size: 14px;
            color: #333;
            font-weight: 500;
        }

        .copy-btn {
            background: #3498DB;
            color: white;
            border: none;
            border-radius: 4px;
            padding: 4px 8px;
            font-size: 12px;
            cursor: pointer;
        }

        .logistics-timeline {
            position: relative;
            padding-left: 20px;
        }

        .timeline-item {
            position: relative;
            padding-bottom: 16px;
        }

        .timeline-item:last-child {
            padding-bottom: 0;
        }

        .timeline-item::before {
            content: '';
            position: absolute;
            left: -16px;
            top: 6px;
            width: 8px;
            height: 8px;
            background: #3498DB;
            border-radius: 50%;
        }

        .timeline-item:not(:last-child)::after {
            content: '';
            position: absolute;
            left: -12px;
            top: 14px;
            width: 1px;
            height: calc(100% - 6px);
            background: #ddd;
        }

        .timeline-content {
            font-size: 14px;
            color: #333;
            margin-bottom: 4px;
        }

        .timeline-time {
            font-size: 12px;
            color: #666;
        }

        /* 地址信息 */
        .address-section {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .address-icon {
            width: 20px;
            height: 20px;
            background: #3498DB;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 12px;
            flex-shrink: 0;
        }

        .address-info {
            flex: 1;
        }

        .address-name-phone {
            font-size: 14px;
            font-weight: 500;
            margin-bottom: 4px;
        }

        .address-detail {
            font-size: 13px;
            color: #666;
            line-height: 1.4;
        }

        /* 商品信息 */
        .product-item {
            display: flex;
            gap: 12px;
            margin-bottom: 12px;
        }

        .product-item:last-child {
            margin-bottom: 0;
        }

        .product-image {
            width: 60px;
            height: 60px;
            border-radius: 6px;
            background: #f0f0f0;
            object-fit: cover;
        }

        .product-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .product-title {
            font-size: 14px;
            font-weight: 500;
            line-height: 1.3;
        }

        .product-specs {
            font-size: 12px;
            color: #666;
        }

        .product-price-qty {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 4px;
        }

        .product-price {
            font-size: 14px;
            font-weight: 600;
            color: #e74c3c;
        }

        .product-qty {
            font-size: 12px;
            color: #666;
        }

        /* 订单信息 */
        .order-info-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px solid #f0f0f0;
        }

        .order-info-item:last-child {
            border-bottom: none;
        }

        .info-label {
            font-size: 14px;
            color: #666;
        }

        .info-value {
            font-size: 14px;
            color: #333;
            font-weight: 500;
        }

        /* 费用明细 */
        .cost-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            font-size: 14px;
        }

        .cost-label {
            color: #666;
        }

        .cost-value {
            color: #333;
        }

        .cost-value.discount {
            color: #27ae60;
        }

        .cost-value.total {
            color: #e74c3c;
            font-weight: 600;
            font-size: 16px;
        }

        /* 支付方式 */
        .payment-info {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .payment-icon {
            width: 32px;
            height: 32px;
            background: #07c160;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 14px;
        }

        .payment-details {
            flex: 1;
        }

        .payment-name {
            font-size: 14px;
            color: #333;
            font-weight: 500;
        }

        .payment-time {
            font-size: 12px;
            color: #666;
        }

        /* 底部操作栏 */
        .bottom-bar {
            position: fixed;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: 375px;
            background: white;
            border-top: 1px solid #eee;
            padding: 12px 16px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .total-info {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .total-price {
            font-size: 16px;
            font-weight: 600;
            color: #e74c3c;
        }

        .total-items {
            font-size: 12px;
            color: #666;
        }

        .action-buttons {
            display: flex;
            gap: 8px;
        }

        .action-btn {
            padding: 10px 20px;
            border: 1px solid #ddd;
            border-radius: 20px;
            background: white;
            color: #666;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .action-btn.primary {
            background: #3498DB;
            color: white;
            border-color: #3498DB;
        }

        .action-btn:disabled {
            background: #bdc3c7;
            cursor: not-allowed;
        }

        /* 未支付状态的特殊样式 */
        .unpaid-status {
            background: linear-gradient(135deg, #f39c12, #e67e22);
        }

        .countdown-timer {
            margin-top: 8px;
            font-size: 16px;
            font-weight: 600;
        }
    </style>
</head>
<body>
    <div class="header">
        <button class="back-btn">←</button>
        <h1>订单详情</h1>
        <div class="capsule-btn">
            <div class="dot"></div>
            <div class="dot"></div>
            <div class="dot"></div>
        </div>
    </div>

    <div class="main-content">
        <!-- 订单状态 -->
        <div class="order-status-section" id="orderStatus">
            <div class="status-icon" id="statusIcon">📦</div>
            <div class="status-title" id="statusTitle">商品已发货</div>
            <div class="status-desc" id="statusDesc">您的商品正在路上，请耐心等待</div>
            <div class="countdown-timer" id="countdownTimer" style="display: none;">
                剩余支付时间：29分58秒
            </div>
        </div>

        <!-- 物流信息 (仅已支付订单显示) -->
        <div class="section logistics-section" id="logisticsSection">
            <div class="section-title">
                <span>🚚</span>
                <span>物流信息</span>
            </div>
            <div class="logistics-header">
                <div class="logistics-icon">🚛</div>
                <div class="logistics-info">
                    <div class="logistics-status">运输中</div>
                    <div class="logistics-time">预计明天送达</div>
                </div>
            </div>
            <div class="tracking-number">
                <div>
                    <span class="tracking-label">快递单号</span>
                </div>
                <div style="display: flex; align-items: center; gap: 8px;">
                    <span class="tracking-value">SF1234567890123</span>
                    <button class="copy-btn">复制</button>
                </div>
            </div>
            <div class="logistics-timeline">
                <div class="timeline-item">
                    <div class="timeline-content">【北京市】快件已发车</div>
                    <div class="timeline-time">2024-01-15 16:30</div>
                </div>
                <div class="timeline-item">
                    <div class="timeline-content">【北京市】快件已到达 北京转运中心</div>
                    <div class="timeline-time">2024-01-15 14:20</div>
                </div>
                <div class="timeline-item">
                    <div class="timeline-content">【北京市】快件已从 北京朝阳区营业点 发出</div>
                    <div class="timeline-time">2024-01-15 10:15</div>
                </div>
                <div class="timeline-item">
                    <div class="timeline-content">【北京市】快件已在 北京朝阳区营业点 装车</div>
                    <div class="timeline-time">2024-01-15 08:30</div>
                </div>
            </div>
        </div>

        <!-- 收货地址 -->
        <div class="section">
            <div class="section-title">
                <span>📍</span>
                <span>收货地址</span>
            </div>
            <div class="address-section">
                <div class="address-icon">📍</div>
                <div class="address-info">
                    <div class="address-name-phone">张三 138****8888</div>
                    <div class="address-detail">北京市朝阳区三里屯街道工体北路8号院1号楼101室</div>
                </div>
            </div>
        </div>

        <!-- 商品信息 -->
        <div class="section">
            <div class="section-title">
                <span>📦</span>
                <span>商品信息</span>
            </div>
            <div class="product-item">
                <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Crect width='60' height='60' fill='%23f0f0f0'/%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dy='0.3em' font-family='Arial' font-size='10' fill='%23999'%3E鱼竿%3C/text%3E%3C/svg%3E" alt="碳素鱼竿" class="product-image">
                <div class="product-info">
                    <div class="product-title">碳素超轻鱼竿 3.6米台钓竿</div>
                    <div class="product-specs">长度: 3.6米 | 调性: 28调</div>
                    <div class="product-price-qty">
                        <span class="product-price">¥168.00</span>
                        <span class="product-qty">x1</span>
                    </div>
                </div>
            </div>
            <div class="product-item">
                <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Crect width='60' height='60' fill='%23f0f0f0'/%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dy='0.3em' font-family='Arial' font-size='10' fill='%23999'%3E鱼线%3C/text%3E%3C/svg%3E" alt="尼龙鱼线" class="product-image">
                <div class="product-info">
                    <div class="product-title">进口尼龙鱼线 100米装</div>
                    <div class="product-specs">线号: 2.0号 | 拉力: 8.5kg</div>
                    <div class="product-price-qty">
                        <span class="product-price">¥35.00</span>
                        <span class="product-qty">x2</span>
                    </div>
                </div>
            </div>
        </div>

        <!-- 订单信息 -->
        <div class="section">
            <div class="section-title">
                <span>📋</span>
                <span>订单信息</span>
            </div>
            <div class="order-info-item">
                <span class="info-label">订单号</span>
                <span class="info-value">202401150001</span>
            </div>
            <div class="order-info-item">
                <span class="info-label">下单时间</span>
                <span class="info-value">2024-01-15 14:30</span>
            </div>
            <div class="order-info-item" id="payTimeItem">
                <span class="info-label">支付时间</span>
                <span class="info-value">2024-01-15 14:35</span>
            </div>
            <div class="order-info-item">
                <span class="info-label">配送方式</span>
                <span class="info-value">标准配送</span>
            </div>
        </div>

        <!-- 支付信息 (仅已支付订单显示) -->
        <div class="section" id="paymentSection">
            <div class="section-title">
                <span>💳</span>
                <span>支付信息</span>
            </div>
            <div class="payment-info">
                <div class="payment-icon">微</div>
                <div class="payment-details">
                    <div class="payment-name">微信支付</div>
                    <div class="payment-time">2024-01-15 14:35</div>
                </div>
            </div>
        </div>

        <!-- 费用明细 -->
        <div class="section">
            <div class="section-title">
                <span>💰</span>
                <span>费用明细</span>
            </div>
            <div class="cost-item">
                <span class="cost-label">商品金额</span>
                <span class="cost-value">¥238.00</span>
            </div>
            <div class="cost-item">
                <span class="cost-label">运费</span>
                <span class="cost-value">¥0.00</span>
            </div>
            <div class="cost-item">
                <span class="cost-label">优惠券</span>
                <span class="cost-value discount">-¥20.00</span>
            </div>
            <div class="cost-item">
                <span class="cost-label">实付金额</span>
                <span class="cost-value total">¥218.00</span>
            </div>
        </div>
    </div>

    <div class="bottom-bar" id="bottomBar">
        <div class="total-info">
            <div class="total-price">¥218.00</div>
            <div class="total-items">共2件商品</div>
        </div>
        <div class="action-buttons" id="actionButtons">
            <button class="action-btn">联系客服</button>
            <button class="action-btn primary">确认收货</button>
        </div>
    </div>

    <script>
        // 模拟不同的订单状态
        const orderStatuses = {
            unpaid: {
                title: '等待付款',
                desc: '请在30分钟内完成支付',
                icon: '⏰',
                showLogistics: false,
                showPayment: false,
                showCountdown: true,
                bgClass: 'unpaid-status',
                buttons: [
                    { text: '取消订单', type: 'normal' },
                    { text: '立即支付', type: 'primary' }
                ]
            },
            paid: {
                title: '商家备货中',
                desc: '商家正在为您准备商品',
                icon: '📦',
                showLogistics: false,
                showPayment: true,
                showCountdown: false,
                bgClass: '',
                buttons: [
                    { text: '联系客服', type: 'normal' }
                ]
            },
            shipped: {
                title: '商品已发货',
                desc: '您的商品正在路上，请耐心等待',
                icon: '🚚',
                showLogistics: true,
                showPayment: true,
                showCountdown: false,
                bgClass: '',
                buttons: [
                    { text: '查看物流', type: 'normal' },
                    { text: '确认收货', type: 'primary' }
                ]
            },
            completed: {
                title: '交易完成',
                desc: '感谢您的购买，欢迎再次光临',
                icon: '✅',
                showLogistics: true,
                showPayment: true,
                showCountdown: false,
                bgClass: '',
                buttons: [
                    { text: '申请售后', type: 'normal' },
                    { text: '再次购买', type: 'primary' }
                ]
            }
        };

        // 从URL参数获取订单状态
        function getOrderStatus() {
            const urlParams = new URLSearchParams(window.location.search);
            return urlParams.get('status') || 'shipped';
        }

        // 初始化页面
        function initPage() {
            const status = getOrderStatus();
            const config = orderStatuses[status];
            
            if (!config) return;

            // 更新状态显示
            document.getElementById('statusIcon').textContent = config.icon;
            document.getElementById('statusTitle').textContent = config.title;
            document.getElementById('statusDesc').textContent = config.desc;
            
            // 更新背景样式
            const statusSection = document.getElementById('orderStatus');
            if (config.bgClass) {
                statusSection.className = `order-status-section ${config.bgClass}`;
            }

            // 显示/隐藏物流信息
            const logisticsSection = document.getElementById('logisticsSection');
            if (config.showLogistics) {
                logisticsSection.classList.add('show');
            }

            // 显示/隐藏支付信息
            const paymentSection = document.getElementById('paymentSection');
            const payTimeItem = document.getElementById('payTimeItem');
            if (!config.showPayment) {
                paymentSection.style.display = 'none';
                payTimeItem.style.display = 'none';
            }

            // 显示/隐藏倒计时
            const countdownTimer = document.getElementById('countdownTimer');
            if (config.showCountdown) {
                countdownTimer.style.display = 'block';
                startCountdown();
            }

            // 更新底部按钮
            updateBottomButtons(config.buttons);
        }

        // 更新底部按钮
        function updateBottomButtons(buttons) {
            const actionButtons = document.getElementById('actionButtons');
            actionButtons.innerHTML = buttons.map(btn => 
                `<button class="action-btn ${btn.type === 'primary' ? 'primary' : ''}">${btn.text}</button>`
            ).join('');
        }

        // 倒计时功能
        function startCountdown() {
            let timeLeft = 30 * 60; // 30分钟
            
            function updateTimer() {
                const minutes = Math.floor(timeLeft / 60);
                const seconds = timeLeft % 60;
                const timerElement = document.getElementById('countdownTimer');
                timerElement.textContent = `剩余支付时间：${minutes}分${seconds.toString().padStart(2, '0')}秒`;
                
                if (timeLeft <= 0) {
                    timerElement.textContent = '支付超时，订单已取消';
                    return;
                }
                
                timeLeft--;
            }
            
            updateTimer();
            setInterval(updateTimer, 1000);
        }

        // 复制快递单号
        function copyTrackingNumber() {
            const trackingNumber = 'SF1234567890123';
            navigator.clipboard.writeText(trackingNumber).then(() => {
                alert('快递单号已复制');
            });
        }

        // 绑定复制按钮事件
        document.addEventListener('DOMContentLoaded', function() {
            const copyBtn = document.querySelector('.copy-btn');
            if (copyBtn) {
                copyBtn.addEventListener('click', copyTrackingNumber);
            }
        });

        // 初始化页面
        initPage();
    </script>
</body>
</html> 